package conexion;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;

public class Eliminar {

	public static void eliminarContrato(String tradeId){
		URL urlEliminarContrato;
		HttpsURLConnection connectionEliminarContrato = null;
		String lineEliminarContrato="0";
		String setCookie = Conexion.EASW_KEY + "; " + Conexion.easf_sess_com + "; FUTWebPhishing" + Conexion.FUTWebPhishing;
		try{
			urlEliminarContrato = new URL("https://utas.fut.ea.com/ut/game/fifa13/trade/"+tradeId);
			connectionEliminarContrato = (HttpsURLConnection)urlEliminarContrato.openConnection();
			connectionEliminarContrato.setRequestMethod("POST");
			connectionEliminarContrato.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31");
			connectionEliminarContrato.setRequestProperty("Cookie", setCookie);
			connectionEliminarContrato.setRequestProperty("Content-Type", "application/json");       
			connectionEliminarContrato.setRequestProperty("X-UT-SID", Conexion.XUTSID);       
			connectionEliminarContrato.setRequestProperty("X-HTTP-Method-Override", "DELETE");
			connectionEliminarContrato.setUseCaches (false);connectionEliminarContrato.setDoInput(true);connectionEliminarContrato.setDoOutput(true);          
			                                      
			//Get Response  
			InputStream isEliminarContrato = connectionEliminarContrato.getInputStream();             
			BufferedReader rdEliminarContrato = new BufferedReader(new InputStreamReader(isEliminarContrato));                
			lineEliminarContrato = rdEliminarContrato.readLine();             
			//System.out.println("\n"+lineEliminarContrato);
			System.out.println("Eliminado");
			Thread.sleep(500);
		}
		catch(Exception e){}
	}

}
